<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>

<!DOCTYPE html>
<html lang="en" style="overflow-x: hidden">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="msapplication-tap-highlight" content="no">

<link rel="stylesheet" href="<%=commonPath%>/pageRc/layui/css/layui.css"
	media="all">
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/utils.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/msgTool.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/layui/layui.js"></script>

<title>端对端</title>

<script>
	$(function(){

 	})
	//注意：选项卡 依赖 element 模块，否则无法进行工能性操作
	layui.use('element', function() {
		var element = layui.element();

		//…
	});
</script>
<jsp:include page="publicMethod.jsp" />
</head>
<body class="layui-main" style="width: 100%;">
<input type="hidden" value="${positionType}" id="positionType">
	<blockquote class="layui-elem-quote">端对端</blockquote>
		<form id="createMsgForm" name="createMsgForm" class="layui-form"
			action="">
			<div class="layui-form-item">
				<div class="layui-inline">
					<div class="layui-inline">
						<input class="layui-input" style="width: 210" id="needNo"
							placeholder="需求编号">
					</div>
					<div class="layui-inline">
						<button class="layui-btn" type="button" data-method="doSearchSum">查询</button>
						<button class="layui-btn" type="button" data-method="doExcel">excel下载</button>
					</div>
				</div>
			</div>


			<div class="layui-form-item">
				<div class="layui-inline">
						<input class="layui-input" style="width: 210" id="startDate"
							value="${sysdate}"
							onclick="layui.laydate({elem: this, istime: true, format: 'YYYYMMDD'})"
							placeholder="报工日期">
					</div>
					<div class="layui-inline">
				<input class="layui-input" style="width: 210" id="endDate"
					value="${sysdate}"
					onclick="layui.laydate({elem: this, istime: true, format: 'YYYYMMDD'})"
					placeholder="到">
			</div>
			</div>
			<div class="layui-form-item" id="dateDiv">
				<div class="layui-inline">
					<table class="layui-table" lay-even="" lay-skin="line"
						style="text-align: center;width: 100%;">
						<colgroup align="center">
							<col width="10%">
							<col width="10%">
							<col width="10%">
							<col width="10%">
							<col width="10%">
							<col width="10%">
							<col width="10%">
							<col width="10%">
							<col width="10%">
							<col width="10%">
							<col width="10%">
							<col width="10%">
						</colgroup>
						<thead>
							<tr>
								<th>需求编号</th>
								<th>需求名称</th>
								<th>干系人</th>
								<th>需求来源方(首次录入项目组)</th>
								<th>渠道团队关联项目组</th>
								<th>基础团队关联项目组</th>
								<th>资管团队关联项目组</th>
								<th>信贷团队关联项目组</th>
								<th>数据团队关联项目组</th>
								<th>首次录入时间</th>
								<th>最近录入时间</th>
								<th>关联团队数量</th>
							</tr>
						</thead>
						<tbody id="detailDiv">

						</tbody>
						<script id="tplSrc" type="text/html">
							{{#  layui.each(d.needList, function(index, x){}}
							     <tr align="left">
								   <td>{{x.needNo==undefined?'':x.needNo}}</td>
								   <td>{{x.needName==undefined?'':x.needName}}</td>
								   <td>{{x.hfjl==undefined?'':x.hfjl}}</td>
								   <td>{{x.proTeamName==undefined?'':x.proTeamName}}</td>
								   <td>{{x.qdTEAM==undefined?'':x.qdTEAM}}</td>	
								   <td>{{x.jcTEAM==undefined?'':x.jcTEAM}}</td>	
								   <td>{{x.zgTEAM==undefined?'':x.zgTEAM}}</td>			
								   <td>{{x.xdTEAM==undefined?'':x.xdTEAM}}</td>
								   <td>{{x.sjTEAM==undefined?'':x.sjTEAM}}</td>	
								   <td>{{x.minDATE==undefined?'':x.minDATE}}</td>
								   <td>{{x.maxDATE==undefined?'':x.maxDATE}}</td>
                                   <td>{{x.groupCount==undefined?'':x.groupCount}}</td>
 							    </tr>
							{{#  }); }} 
					   </script>
					</table>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-inline">
					<div id="laypageDiv"></div>
				</div>
			</div>
		</form>
	</div>
	<input id="totalNum" type="hidden" name="totalNum" >
</body>
<script type="text/javascript">
var path="<%=commonPath%>";
	var msg = new msgTool();
	layui.use([ 'form', 'layer', 'laytpl', 'laypage', 'laydate' ],
	function() {
	var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
						var form = layui.form(), layer = layui.layer, laypage = layui.laypage, laytpl = layui.laytpl;
						var active = {
							doSearchSum : function() { //搜索
						      	     active.doSearchDetail(1); 
						         }
						         ,doSearchDetail:function(v_curr){ //搜索
						        if(v_curr==1){
						      	    var getTpl = tplSrc.innerHTML;
						  			var dataObj = {
						  						"startRow" : (v_curr-1)*15,
						  						"pageSize" : 15,
												"needNo" : $("#needNo").val(),
												"bgnWorkDate":$("#startDate").val(),
												"endWorkDate":$("#endDate").val(),
						  					};
						  			msg.sendMsg("/page/main/selectFacetoFace.do",dataObj,function(data) {
						  				laytpl(getTpl).render(data.body,function(html) {
						  				    detailDiv.innerHTML = html;
						  					$('#totalNum').val(data.body.count);
						  				});
						  				totalNum = Math.ceil(data.body.count/15);
						  				laypage({
							                   cont: 'laypageDiv'
							                 ,pages:totalNum
							                  ,jump: function(obj,first){
							                	  if(first!=true){
							                	  	active.doSearchDetail(obj.curr); 
							                	  }
							                   }
							                 });  
						  			}); 
						         }else{
						        	 var getTpl = tplSrc.innerHTML;
							  			var dataObj = {
							  						"startRow" : (v_curr-1)*15,
							  						"pageSize" : 15,
													"needNo" : $("#needNo").val(),
													"bgnWorkDate":$("#startDate").val(),
													"endWorkDate":$("#endDate").val(),
							  					};
							  			msg.sendMsg("/page/main/selectFacetoFace.do",dataObj,function(data) {
							  				laytpl(getTpl).render(data.body,function(html) {
							  				    detailDiv.innerHTML = html;
							  					$('#totalNum').val(data.body.count);
							  				});
							  				 
							  			}); 
						         }
						         }, 
								
								
								
							
								
							doExcel : function() {
								var dataObj = {
									"needNo" : $("#needNo").val(),
									"bgnWorkDate":$("#startDate").val(),
									"endWorkDate":$("#endDate").val(),
								}
								msg.sendMsg("/page/main/doExcelFacetoFace.do",
										dataObj, function(data) {
											window.location.href = path
					+ "/downFile/"
					+ data.body.fileName
			});
		}
	}
	$('.layui-btn').on('click',function() {
		var othis = $(this), method = othis.data('method');
		active[method] ? active[method].call(this,othis) : '';
	});
});
	function searchByNeedId(needId) {
			layer.open({
			 type: 2,
			 title:"详细信息",
			 area: ['95%', '95%	'],
			 scrollbar: false,
			 content: '<%=commonPath%>/page/main/' + needId+ '/searchDetailByNeedId.do',
			success : function(layero, index) {
			},
			end : function() {
			}
		});
	}
	
</script>

</html>